//
//  TitleCollectionDecorationView.swift
//  ATSectionWaterfallFlowLayoutExample
//
//  Created by dfsx6 on 2021/9/2.
//

import UIKit

class TitleCollectionDecorationView: UICollectionReusableView {

    
    @IBOutlet weak var bgImageView: UIImageView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    open override func apply(_ layoutAttributes: UICollectionViewLayoutAttributes) {
        super.apply(layoutAttributes)
        
        let indexPath = layoutAttributes.indexPath
        let row = indexPath.section
        let imageName = "decorationView\(row + 1)"
        bgImageView.image = UIImage.init(named: imageName)
        
        if indexPath.section == 2 {
            bgImageView.backgroundColor = UIColor.green
        }
    }
}
